//
//  ICMineSocketManager.m
//  ICome
//
//  Created by zhangrongwu on 16/9/26.
//  Copyright © 2016年 iCom. All rights reserved.
//

#import "ICChatSocketManager.h"

@implementation ICChatSocketManager
+(instancetype)sharedInstance {
    static ICChatSocketManager *manager;
    static dispatch_once_t once;
    dispatch_once(&once, ^{
        manager = [[ICChatSocketManager alloc] init];
    });
    return manager;
}


/** chat中 发送消息  socket消息发送 identifier （内容+时间).Md5 */
-(void)sendMessageWithParam:(NSDictionary *)param
                 identifier:(NSString *)identifier
                    Success:(SendSuccessCompletionHandle)success
                    Failure:(SocketFailureCompletionHandle)failure {
    NSDictionary *body = [self packageRequestObject:param Api:MESSAGE_SENDMESSAGE];
    [[ICSocketCommunicationManager sharedInstance] requestWithRequestType:SCRequestType_Normal requestBody:body Identifier:identifier completion:^(id data, NSError *error, id other) {
        if (requestSuccess) {
            NSDictionary *object = [data objectForKey:@"data"];
            success(object, other);
        } else {
            failure(error, other);
        }
    }];
}
@end
